<template>
  <base-option :selected="selected" :field-config="fieldConfig" :form-config="formConfig">
    <template #default="{ hideOptions }">
      <el-form-item v-if="hideOptions('min')" label="最小值">
        <el-input-number v-model="fieldConfig.min" :min="0" :max="fieldConfig.max" controls-position="right" />
      </el-form-item>
      <el-form-item v-if="hideOptions('max')" label="最大值">
        <el-input-number
          v-model="fieldConfig.max"
          :min="fieldConfig.min"
          :max="999999999999999"
          controls-position="right"
        />
      </el-form-item>
      <el-form-item v-if="fieldConfig.decimalPlaces !== undefined && hideOptions('decimalPlaces')" label="小数位数">
        <el-radio-group v-model="fieldConfig.decimalPlaces">
          <el-radio :value="1">1位</el-radio>
          <el-radio :value="2">2位</el-radio>
        </el-radio-group>
      </el-form-item>
      <div style="padding-left: 82px">
        <el-checkbox v-model="fieldConfig.omitEndZero" label="省略末尾的0" />
      </div>
    </template>
  </base-option>
</template>

<script setup>
import { toRefs } from 'vue'
import baseOption from './base-option.vue'
import propsDefinition from './props'
const props = defineProps(propsDefinition)
const { selected, fieldConfig, formConfig } = toRefs(props)
</script>
